<link href="Style.css" rel="stylesheet" type="text/css" />
<?php
session_start(); 

require("sql_functions.php");

if(isset($_SESSION['user']))
{
	$user = $_SESSION['user'];
	
  $emps = sql_getEmployees();
  
  
	echo "<html>"; 
	echo "<head>"; 
	echo "</head>"; 
	echo "<body>";
	echo "<p>Employee Tasks Report"; 
		
	echo "<table border='1'>";	
	echo "<tr><td>Employee Name</td><td>Open Tasks</td><td>Closed Tasks</td><td>Total Tasks</td><td>Total Hours</td>";
	while($row = mysql_fetch_array($emps))
	{	
    $fName = $row['FirstName'];
    $lName = $row['LastName'];
    $name = "$fName $lName";
    
    $email = $row['Email'];
    
    $hours = sql_getEmployeeHours($email);
    
    $tasks = sql_getEmployeeTasks($email);  
    $taskCount = 0;
    while($task = mysql_fetch_array($tasks))
    {
      $taskCount = $taskCount + 1;
    }
    
    $openTasks = sql_getEmployeeOpenTasks($email);  
    $openTaskCount = 0;
    while($task = mysql_fetch_array($openTasks))
    {
      $openTaskCount = $openTaskCount + 1;
    }
    
    $closedTasks = sql_getEmployeeClosedTasks($email);  
    $closedTaskCount = 0;
    while($task = mysql_fetch_array($closedTasks))
    {
      $closedTaskCount = $closedTaskCount + 1;
    }

		echo "<tr><td>";
		echo "$name";
		echo "</td><td>";
		echo "$openTaskCount";
		echo "</td><td>";
		echo "$closedTaskCount";
		echo "</td><td>";
		echo "$taskCount";
		echo "</td><td>";
		echo "$hours";
		echo "</td></tr>";
			
		$tasks = sql_getMilestoneTasks($pid, $mName);
		while($row = mysql_fetch_array($milestones))
		{
			$tName = $row['TaskName'];
			$tDueDate = $row['DueDate'];
			$tStatus = "Fixme";
			$tTotalHours = "Fixme";

			echo "<tr><td>";
			echo "$tName";
			echo "</td><td>";
			echo "$tDueDate";
			echo "</td><td>";
			echo "";
			echo "</td><td>";
			echo "$tStatus";
			echo "</td><td>";
			echo "$tTotalHours";
			echo "</td></tr>";
		}

	}
	echo "</table>";
    	
	echo "</body>"; 
	echo "</html>";  


}
else
{
	echo "Must be logged in to view this page.";
}

?>




